@using IdentityServer4.Extensions
@using Microsoft.AspNetCore.Mvc.Localization
@using Microsoft.AspNetCore.Identity
@using IdentityUser = Maple.Branch.Identity.Entities.IdentityUser
@inject IHtmlLocalizer<AuthServerLocalResource> Localizer
@{
    string name = null;
    if (!true.Equals(ViewData["signed-out"]))
    {
        name = Context.User?.GetDisplayName();
    }
}
@inject SignInManager<IdentityUser> SignInManager
@{
    var hasExternalLogins = (await SignInManager.GetExternalAuthenticationSchemesAsync()).Any();
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Skoruba IdentityServer4</title>
    <link rel="icon" type="image/x-icon" href="/favicon.ico" />
    <link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />

    <link href="~/dist/css/bundle.min.css" asp-append-version="true" rel="stylesheet" />
    <link href="~/dist/css/web.min.css" asp-append-version="true" rel="stylesheet" />

    @RenderSection("styles", required: false)
</head>
<body>
    <div class="menu d-flex flex-column flex-md-row align-items-center p-3 px-md-4 mb-3 bg-white border-bottom box-shadow">
        <!--Site name -->
        <h3 class="menu-logo my-0 mr-md-auto font-weight-normal">
            <a class="logo" asp-area="" asp-controller="Home" asp-action="Index">
                Skoruba IdentityServer4
            </a>
        </h3>

        <!--Menu item -->
        @if (User.Identity.IsAuthenticated && !string.IsNullOrEmpty(name))
        {
        <span class="menu-item my-2 my-md-0 mr-md-3">@name</span>
        <a class="menu-item my-2 btn btn-outline-primary" asp-action="Logout" asp-controller="Account">@Localizer["Layout:Signout"]</a>
        }

        @await Html.PartialAsync("Components/LanguageSwitch")
    </div>

    <div class="container">
        @RenderBody()

        <footer class="pt-4 my-md-5 pt-md-5 border-top">
            <div class="row">
                <div class="col-12 col-md">
                    Skoruba IdentityServer4 &copy; @DateTime.Now.Year
                </div>
            </div>
        </footer>
    </div>

    <script src="~/dist/js/bundle.min.js" asp-append-version="true"></script>

    @RenderSection("scripts", required: false)
</body>
</html>
